package cn.com.homeyoda.aimate.aihealth.ui.videoinspect;

import android.content.Context;
import android.util.SparseBooleanArray;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wzq.mvvmsmart.utils.GlideLoadUtils;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import cn.com.homeyoda.aimate.aihealth.R;
import cn.com.homeyoda.aimate.aihealth.bean.HomeReportListBean;
import cn.com.homeyoda.aimate.aihealth.bean.TiJianRecordBean;

/**
 * Created By 刘纯贵
 * Created Time 2020/4/30
 */
public class RecordAdapter extends BaseQuickAdapter<HomeReportListBean.RowsBean, BaseViewHolder> {

    private Context mContext;

    private float xDown, xMove;
    private int currentPosition = -1;
    private boolean isDeleteShown = false;
    LinearLayout mainContent;
    TextView del;
    RelativeLayout delRel;
    private Set<Integer> deleteShownPositions = new HashSet<>(); // 记录显示删除按钮的位置
    private SparseBooleanArray deleteShownStates = new SparseBooleanArray();
    BaseViewHolder baseViewHolder;
    public RecordAdapter(int layoutResId, @Nullable List<HomeReportListBean.RowsBean> data, Context context) {
        super(layoutResId, data);
        mContext = context;
    }



    @Override
    public void onBindViewHolder(BaseViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        baseViewHolder = holder;
//        holder.setText(R.id.problem_btn,getData().get(position));
        holder.setText(R.id.name,getData().get(position).getName());
        holder.setText(R.id.time,getData().get(position).getAddTime());
        holder.setText(R.id.remark,getData().get(position).getRemark());
        GlideLoadUtils.loadCircleImg(mContext,R.mipmap.tou_bg,getBaseViewHolder().getView(R.id.head),getData().get(position).getAvatar());
        // 重置视图状态

        holder.addOnClickListener(R.id.right);
        holder.addOnClickListener(R.id.content);

    }

    public BaseViewHolder getBaseViewHolder(){
        return baseViewHolder;
    }

        @Override
        protected void convert(@NonNull BaseViewHolder helper, HomeReportListBean.RowsBean item) {

        }


        @Override
        public void setNewData(@Nullable List<HomeReportListBean.RowsBean> data) {
            super.setNewData(data);
        }

        public void removeItem(int position) {
            mData.remove(position);
            notifyItemRemoved(position);
        }



}
